import { get, lsGetStr, post } from "../../utils/request.js";
import { getType } from "../../utils/data_type.js";

Component({
    properties: {},
    data: {},
    lifetimes: {
        attached: function () {
        },
        moved: function () {
        },
        detached: function () {
        },
    },
    attached() {
    }, // 此处attached的声明会被lifetimes字段中的声明覆盖
    ready: function () {},
    methods: {
      urgent: function (e) {
        var id = e.target.dataset.id;
        console.log(id);
        if (id == 14225) {
          wx.navigateTo({
            url: '../../pages/urgent/index?type=' + id,
          })
        } else {
          wx.navigateTo({
            url: '../../pages/item/index?type=' + id + '&id=979',
          })
        }
      },
    },

    pageLifetimes: {
        // 组件所在页面的生命周期函数
        show: function () {
            let that = this;
          get({
            path: '/category1/list?type1=' + getType.category + '&isShow=1&sortField=order_num&sortOrder=ASC'
            })
                .then(function (res) {
                  console.log(res)
                    that.setData({
                      categorys: res
                    })
                })
        },
    },
})